﻿Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class LandschaftstexturStrasse
    Inherits ObjektLandschaftsTextur
    Dim Landschaftstexturen() As Texture
    Dim LandschaftsTexturAusrichtung() As String = {"+N", "+O", "+S", "+W", "+N+O", "+N+S", "+N+W", "+O+S", "+O+W", "+S+W", "+N+O+S", "+N+O+W", "+N+S+W", "+O+S+W", "+N+O+S+W"}


    Public Sub New()
        ID = "STRASSE"
        Landschaftsname = "Strasse"
        Deckung = 0
        Tarnung = False
        KP = -1
        TexturenLaden(New String() {"Strasse+S", "Strasse+N+O", "Strasse+N+O+S+W", "Strasse+N+O+W", "Strasse+N+S", "Strasse+N+S+W", "Strasse+N+W", "Strasse+N+O+S", "Strasse+O+W", "Strasse+O+S+W", "Strasse+S+W", "Strasse+O+S", "Strasse+O", "Strasse+W", "Strasse+N"})
        Normal = 0
        Ausrichtungslandschaften = New String() {"STRASSENFROST", "PFAD", "STRASSE", "BRUECKE", "HQ", "STADT", "BASIS", "HAFEN", "FLUGHAFEN", "TURM", "WERFT", "ZUGBRUECKE", "BAUBRUECKE"}
        If DataSettings.draw3D Then
            Ini3D()
        End If
    End Sub

    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function

    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"EBENE", "WUESTE", "SCHNEE"}
    End Function

    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)
        Dim ind As Integer = 0
        Dim Ausr As String = getAusrichtung(Landschaft.KooX, Landschaft.KooY, Objektverwalter.Spielfeld).ToUpper
        For i = 0 To LandschaftsTexturAusrichtung.Length - 1
            If Ausr = LandschaftsTexturAusrichtung(i).ToUpper Then
                'Ha, das muesste sie sein!
                ind = i
                Exit For
            End If
        Next
        Grafikengine.Grafikkarte.SetTexture(0, Landschaftstexturen(ind))
        Dim standardMatrix As Matrix = Grafikengine.Grafikkarte.Transform.World
        Grafikengine.Grafikkarte.Transform.World = p_MatCube


        'Berechnen:
        Dim Farbe As Color = ObjektmarkiertesFeld.getFeldFarbe(Landschaft.KooX, Landschaft.KooY)
        Dim cube(3) As CustomVertex.PositionNormalTextured
        cube(0) = New CustomVertex.PositionNormalTextured(0, 0, 0, 0, 1, 0, 0, 1)
        cube(1) = New CustomVertex.PositionNormalTextured(0, 0, 1, 0, 1, 0, 0, 0)
        cube(2) = New CustomVertex.PositionNormalTextured(1, 0, 0, 0, 1, 0, 1, 1)
        cube(3) = New CustomVertex.PositionNormalTextured(1, 0, 1, 0, 1, 0, 1, 0)


        'Anzeigen:
        Dim M As New Material
        M.Diffuse = Farbe
        Grafikengine.Grafikkarte.Material = M
        Grafikengine.Grafikkarte.VertexFormat = CustomVertex.PositionNormalTextured.Format
        Grafikengine.Grafikkarte.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, cube)

        'Wieder den Ursprungsstatus wiederherstellen..
        Grafikengine.Grafikkarte.Transform.World = standardMatrix
    End Sub

    Public Overrides Sub Ini3D()
        ReDim Landschaftstexturen(LandschaftsTexturAusrichtung.Length - 1)
        For i = 0 To Me.LandschaftsTexturAusrichtung.Length - 1
            Landschaftstexturen(i) = Grafikengine.LoadTexture(DataSettings.Resourcenpfad + "Terrain\Overworld\3D\" + DataSettings.TexturQuali + "\Strasse" + LandschaftsTexturAusrichtung(i) + ".png")
        Next
    End Sub

    Public Overrides Sub Tick()

    End Sub
End Class
Public Class LandschaftstexturStrassenfrost
    Inherits ObjektLandschaftsTextur



    Public Sub New()
        ID = "STRASSENFROST"
        Landschaftsname = "Verschneite Strasse"
        Deckung = 0
        Tarnung = False
        KP = -1
        TexturenLaden(New String() {"STRASSENFROST+S", "STRASSENFROST+N+O", "STRASSENFROST+N+O+S+W", "STRASSENFROST+N+O+W", "STRASSENFROST+N+S", "STRASSENFROST+N+S+W", "STRASSENFROST+N+W", "STRASSENFROST+N+O+S", "STRASSENFROST+O+W", "STRASSENFROST+O+S+W", "STRASSENFROST+S+W", "STRASSENFROST+O+S", "STRASSENFROST+O", "STRASSENFROST+W", "STRASSENFROST+N"})
        Normal = 0
        Ausrichtungslandschaften = New String() {"STRASSENFROST", "PFAD", "STRASSE", "BRUECKE", "HQ", "STADT", "BASIS", "HAFEN", "FLUGHAFEN", "TURM", "WUESTENBRUECKE", "WERFT", "ZUGBRUECKE"}
    End Sub

    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function

    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"SCHNEE", "EBENE", "WUESTE"}
    End Function

    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)

    End Sub

    Public Overrides Sub Ini3D()

    End Sub

    Public Overrides Sub Tick()

    End Sub
End Class
Public Class LandschaftstexturPfad
    Inherits ObjektLandschaftsTextur



    Public Sub New()
        ID = "PFAD"
        Landschaftsname = "Wuestenstrasse"
        Deckung = 0
        Tarnung = False
        KP = -1
        TexturenLaden(New String() {"PFAD+S", "PFAD+N+O", "PFAD+N+O+S+W", "PFAD+N+O+W", "PFAD+N+S", "PFAD+N+S+W", "PFAD+N+W", "PFAD+N+O+S", "PFAD+O+W", "PFAD+O+S+W", "PFAD+S+W", "PFAD+O+S", "PFAD+O", "PFAD+W", "PFAD+N"})
        Normal = 0
        Ausrichtungslandschaften = New String() {"STRASSENFROST", "PFAD", "STRASSE", "BRUECKE", "HQ", "STADT", "BASIS", "HAFEN", "FLUGHAFEN", "TURM", "WUESTENBRUECKE", "ZUGBRUECKE", "BAUBRUECKE"}
    End Sub

    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function

    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"WUESTE", "EBENE", "SCHNEE"}
    End Function

    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)

    End Sub

    Public Overrides Sub Ini3D()

    End Sub

    Public Overrides Sub Tick()

    End Sub
End Class
